﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Catering_Rules;
using System.Data;
using Catering.View_Operaction;
using Microsoft.Reporting.WebForms;

namespace Catering.Catering_Page.richang
{
    public partial class SetCateringPersons : System.Web.UI.Page
    {
        private static DataViewForReport dvfr = new DataViewForReport();
        private static View_Monitor vm = new View_Monitor();

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                //LoadPage();
                //if (!string.IsNullOrEmpty(Request.QueryString["userid"]))
                //{
                //    DataTable dt = dvfr.GetPersonModel(Request.QueryString["userid"]);
                //    BingDivControls(dt);
                //    bg.Style[HtmlTextWriterStyle.Display] = "block";
                //    main.Style[HtmlTextWriterStyle.Display] = "block";
                //    LinkButton1_Click(null, new EventArgs());
                //    Request.QueryString["userid"].Remove(0);
                //}
            }
            
        }

        private void LoadPage()
        {
            //DataTable dt = dvfr.GetPersonCount();
            //for (int i = 0; i < dt.Rows.Count; i++)
            //{
            //    ListItem li = new ListItem();
            //    li.Text = dt.Rows[i]["CName"].ToString() + "    " + dt.Rows[i]["Number"].ToString();
            //    LBNumbers.Items.Add(li);
            //}
        }

        private void BingDivControls(DataTable dt)
        {
            //txt_ADD.Text = dt.Rows[0]["ADD"].ToString();
            //txt_Education.Text = dt.Rows[0]["Education"].ToString();
            //txt_Email.Text = dt.Rows[0]["Email"].ToString();
            //txt_MSN.Text = dt.Rows[0]["MSN"].ToString();
            //txt_No.Text = dt.Rows[0]["No"].ToString();
            //txt_Old.Text = dt.Rows[0]["Old"].ToString();
            //txt_Placeoforigin.Text = dt.Rows[0]["Placeoforigin"].ToString();
            //txt_Politicalaffiliation.Text = dt.Rows[0]["Politicalaffiliation"].ToString();
            //txt_Professional.Text = dt.Rows[0]["Professional"].ToString();
            //txt_QQ.Text = dt.Rows[0]["QQ"].ToString();
            //txt_Tel.Text = dt.Rows[0]["Tel"].ToString();
            //txt_Title.Text = dt.Rows[0]["Title"].ToString();
            //txt_UName.Text = dt.Rows[0]["Name"].ToString();
            //txt_Sex.Text = dt.Rows[0]["Sex"].ToString();
        }

        protected void LinkButton1_Click(object sender, EventArgs e)
        {
            //if (RadArea.Checked)
            //{
            //    SetingPerson();
            //}
            //else if (RadCompany.Checked)
            //{
            //    CompanyPerson();
            //}
        }

        protected void SetingPerson()
        {
            //string CLASSID = UCDDLToolWithDate1.GetDDL_Class();
            //string OAREAID = UCDDLToolWithDate1.GetDDL_Area();
            //if (string.IsNullOrEmpty(CLASSID) || string.IsNullOrEmpty(OAREAID))
            //{
            //    return;
            //}
            //string isworking = "2";
            //string isworktext = "";
            //if (RadWorking.Checked)
            //{
            //    isworking = "1";
            //    isworktext = "在岗人员";
            //}
            //if (RadUNWorking.Checked)
            //{
            //    isworking = "0";
            //    isworktext = "歇岗人员";
            //}
            
            //DataTable dt = vm.GetSetingPerson(OAREAID, CLASSID, isworking, isworktext);
            //ReportDataSource rds = new ReportDataSource("DataSet1", dt);
            //ReportViewer1.LocalReport.DataSources.Clear();
            //ReportViewer1.LocalReport.DataSources.Add(rds);
            //ReportViewer1.LocalReport.ReportPath = @"Catering_Page\richang\Report\Set_CateringPersons.rdlc";
            //ReportViewer1.LocalReport.Refresh();
            //ReportViewer1.Visible = true;
        }
        protected void CompanyPerson()
        {
            //DataTable dt1 = vm.GetCompanyPerson("1");
            //DataTable dt2 = vm.GetCompanyPerson("0");
            //ReportDataSource rds1 = new ReportDataSource("DataSet1", dt1);
            //ReportDataSource rds2 = new ReportDataSource("DataSet2", dt2);
            ////ReportViewer1.LocalReport.DataSources.Clear();
            //ReportViewer1.LocalReport.ReportPath = @"Catering_Page\richang\Report\Set_CateringForCompany.rdlc";
            //ReportViewer1.LocalReport.DataSources.Add(rds1);
            //ReportViewer1.LocalReport.DataSources.Add(rds2);
            //ReportViewer1.LocalReport.Refresh();
            //ReportViewer1.Visible = true;
        }
        
        /// <summary>
        /// 配餐公司
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void RadioButton1_CheckedChanged(object sender, EventArgs e)
        {
            //bg.Style[HtmlTextWriterStyle.Display] = "none";
            //main.Style[HtmlTextWriterStyle.Display] = "none";
            
        }

        protected void RadUNWorking_CheckedChanged(object sender, EventArgs e)
        {
            //bg.Style[HtmlTextWriterStyle.Display] = "none";
            //main.Style[HtmlTextWriterStyle.Display] = "none";
        }

        protected void RadWorking_CheckedChanged(object sender, EventArgs e)
        {
            //bg.Style[HtmlTextWriterStyle.Display] = "none";
            //main.Style[HtmlTextWriterStyle.Display] = "none";
        }
    }
}